//
//  YSGameNumView.m
//  Yaoyle
//
//  Created by ZhaoXudong on 14-9-24.
//  Copyright (c) 2014年 ZhaoXudong. All rights reserved.
//

#import "YSGameNumView.h"

//@interface YSGameNumView () {
//    NSInteger maxNumber;
//    NSInteger number;
//}
//
//@end

@implementation YSGameNumView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)setMaxNumber:(NSInteger)maxNum nowNumber:(NSInteger)num {
    
    UIImage *imageLight = [UIImage imageNamed:@"people_bright"];
    UIImage *imageGray = [UIImage imageNamed:@"people_gray"];
    
    CGFloat imageH = imageGray.size.height;
    CGFloat imageW = imageGray.size.width;
    
    CGFloat pX = (100 - (imageGray.size.width * 5)) / 2;
    CGFloat pY = (34 - imageGray.size.height) / 2;
    
    for (int i = 0; i < num; i++) {
        UIImageView *imageView = [[UIImageView alloc] initWithImage:imageLight];
        imageView.frame = CGRectMake(i * imageW + pX, pY, imageW, imageH);
        [self addSubview:imageView];
    }
    
    for (int i = num; i < maxNum; i++) {
        UIImageView *imageView = [[UIImageView alloc] initWithImage:imageGray];
        imageView.frame = CGRectMake(i * imageW + pX, pY, imageW, imageH);
        [self addSubview:imageView];
    }
}

- (void)updateFrame:(CGRect)frame {
    self.frame = frame;
}

@end
